﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TiposComuns.Objectos;

namespace Servidor.Objectos
{
    /// <summary>
    /// Posting a message on the wall
    /// </summary>
    [Serializable]
    public class PostAction : Action
    {
        #region Attributes
        private Post post;      //New post
        #endregion

        #region Constructors
        public PostAction() { }

        public PostAction(IDMsg id,Post post) : base(id)
        {
            this.post = post.Clone();
        }

        public Post Post
        {
            get { return post.Clone(); }
            set { post = value.Clone(); }
        }
        #endregion

        #region Methods
        public override void Execute(User user)
        {
            user.PostMessage(post);
        }

        public override void RollBack(User user)
        {
            user.Wall.Remove(this.post);
        }

        #endregion
    }
}
